<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改项目信息')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-kmPro-edit" th:object="${kmPro}">
			<input id="proId" name="proId" type="hidden" th:field="*{proId}"/>
			<div class="form-group">
				<label class="col-sm-3 control-label">项目名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="proName" id="proName" th:field="*{proName}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">项目类型：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="proType" id="proType" th:field="*{proType}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label ">排序：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="proSort" id="proSort" th:field="*{proSort}" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">项目状态：</label>
				<div class="col-sm-8">
					<div class="radio-box" th:each="dict : ${@dict.getType('pro_state_type')}">
						<input type="radio" th:id="${dict.dictCode}" name="proState" th:value="${dict.dictValue}" th:field="*{proState}">
						<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
					</div>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "km/projectManager";
		
		$("#form-kmPro-edit").validate({
			onkeyup: false,
			rules:{
				proName:{
					remote: {
		                url: ctx + "km/projectManager/checkKmProNameUnique",
		                type: "post",
		                dataType: "json",
		                data: {
		                	"proId": function() {
							    return $("input[name='proId']").val();
							},
		                	"proName" : function() {
		                        return $.common.trim($("#proName").val());
		                    }
		                },
		                dataFilter: function(data, type) {
		                	return $.validate.unique(data);
		                }
		            }
				},
				/*postCode:{
					remote: {
		                url: ctx + "system/post/checkPostCodeUnique",
		                type: "post",
		                dataType: "json",
		                data: {
		                	"postId": function() {
							    return $("input[name='postId']").val();
							},
		                	"postCode" : function() {
		                		return $.common.trim($("#postCode").val());
		                    }
		                },
		                dataFilter: function(data, type) {
		                	return $.validate.unique(data);
		                }
		            }
				},*/
				proSort:{
					digits:true
				},
			},
			messages: {
		        "proName": {
		            remote: "岗位名称已经存在"
		        }
		    },
		    focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/edit", $('#form-kmPro-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
